package com.muyu.cloud.system.remote;

import com.muyu.cloud.system.domain.UserInfo;
import com.muyu.cloud.system.factory.UserInfoRemoteFactory;
import com.muyu.common.constant.ServerNameConstants;
import com.muyu.common.result.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @Author: DongZeLiang
 * @date: 2024/5/24
 * @Description: 用户信息远程调用
 * @Version: 1.0
 */
@FeignClient(
        name = ServerNameConstants.SYSTEM_NAME,
        // "/user-info" -> controller(requestMapping)
        path = ServerNameConstants.SystemApi.USER_INFO_API,
        contextId = "remoteUserInfoService",
        fallbackFactory = UserInfoRemoteFactory.class
)
public interface RemoteUserInfoService {


    /**
     * 通过用户名称查询用户信息
     * @param userName 用户名称
     * @return 用户信息
     */
    @GetMapping("/by/user-name/{userName}")
    public Result<UserInfo> findByUserName(@PathVariable("userName") String userName);
}
